import java.util.ArrayList;
import java.util.Scanner;

/**
 * Project: SecuritySnort
 * This class basically wraps a Scanner object.
 * It spits back an array delimited by white space (default).
 *
 * @author Jonathan Buttner
 * @version Jan 21, 2010
 */

public class LineParser
{
	
	/**************************************************************************
	 * 							Public Methods
	 *************************************************************************/
	/**
	 * This is a utility function to spit back a String tokenized.
	 *  
	 * @param line is the string to be tokenized.
	 * @param delimiter is the thing to delimit.
	 * 
	 * @return an ArrayList of strings.
	 */
	public static ArrayList < String > getArrayStr(
			String line, String delimiter )
	{
		Scanner scan = new Scanner( line );
		scan.useDelimiter( delimiter );
		ArrayList < String > tokenized = new ArrayList < String > ();
		
		//loop through all delimiters
		while ( scan.hasNext() )
		{
			tokenized.add( scan.next() );
		}
		scan.close();
		
		return tokenized;
	}
}
